package com.wanggsx.library.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Build.VERSION;


public class UtilsAppSystem {
    private static final String OSVERSION;
    private static final String DEVICE_NAME;
    private static final String DEVICE_TYPE = "android";
    private static final String DEVICE_ID;
    private static String versionName;
    private static String packageName;
    private static int versionCode;
    private static int AppUserID;
    private static String UserToken;

    public UtilsAppSystem() {
    }

    public static void initAppSystemData(Context context) {
        PackageManager packageManager = context.getPackageManager();
        PackageInfo packInfo = null;

        try {
            packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
            versionName = packInfo.versionName;
            versionCode = packInfo.versionCode;
            packageName = packInfo.packageName;
        } catch (NameNotFoundException var5) {
            var5.printStackTrace();
            versionName = "-1.0.0";
            versionCode = -1;
        }

    }

    public static String getOSVERSION() {
        return OSVERSION;
    }

    public static String getDeviceName() {
        return DEVICE_NAME;
    }

    public static String getDeviceType() {
        return "android";
    }

    public static String getDeviceId() {
        return DEVICE_ID;
    }

    public static String getVersionName() {
        return versionName;
    }

    public static int getVersionCode() {
        return versionCode;
    }

    public static int getAppUserID() {
        return AppUserID;
    }

    public static void setVersionName(String versionName) {
        versionName = versionName;
    }

    public static void setVersionCode(int versionCode) {
        versionCode = versionCode;
    }

    public static void setAppUserID(int appUserID) {
        AppUserID = appUserID;
    }

    public static String getUserToken() {
        return UserToken;
    }

    public static void setUserToken(String userToken) {
        UserToken = userToken;
    }

    public static String getPackageName() {
        return packageName;
    }

    static {
        OSVERSION = VERSION.RELEASE;
        DEVICE_NAME = Build.BRAND + Build.MODEL;
        DEVICE_ID = Build.SERIAL;
    }
}
